﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using Zadani09.db.DAO;

namespace Zadani09.db.ODS
{
    [DataObject(true)]
    public class VstupenkaDataObject
    {
        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Vstupenka> cti(string razeni)
        {
            List<Vstupenka> list = DAOTovarna.instance.getVstupenkaDAO().nahrejVsechnyVstupenky(0, 0);

            if (list == null) list = new List<Vstupenka>();

            return list;
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Vstupenka> ctiVstupenkyJednohoUzivatele(int idUzivatel)
        {
            List<Vstupenka> list = DAOTovarna.instance.getVstupenkaDAO().nahrejListVsupenekProUzivatele(idUzivatel);

            if (list == null) list = new List<Vstupenka>();

            return list;
        }

        [DataObjectMethod(DataObjectMethodType.Delete)]
        public void smaz(Vstupenka data)
        {
            DAOTovarna.instance.getVstupenkaDAO().delete(data);
        }

        [DataObjectMethod(DataObjectMethodType.Update)]
        public void aktualizuj(Vstupenka data)
        {
            DAOTovarna.instance.getVstupenkaDAO().update(data);
        }

    }
}
